package com.bjesc_b2c.app.appraiset.utils;

import android.content.Context;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.util.List;

import master_bean.CarForBean;

import static com.bjesc_b2c.app.appraiset.utils.TimeListUilts.getFromAssets;

/**
 * Created by yidong on 2017/5/16.
 */

public class DataUtils {
    /**
     * 获取车辆来源
     *
     * @param context
     * @return
     */
    public static List<CarForBean> getCarForBean(Context context) {
        String json = getFromAssets(context, "car_brand.json");
        return new Gson().fromJson(json, new TypeToken<List<CarForBean>>() {
        }.getType());

    }
    /**
     * 获取 状态
     *
     * @aram context
     * @return
     */
    public static List<CarForBean> getCarStatus(Context context) {
        String json = getFromAssets(context, "car_status.json");
        return new Gson().fromJson(json, new TypeToken<List<CarForBean>>() {
        }.getType());

    }
    /**
     * 获取 价格选择列表
     *
     * @aram context
     * @return
     */
    public static List<CarForBean> getPriceList(Context context) {
        String json = getFromAssets(context, "price_type.json");
        return new Gson().fromJson(json, new TypeToken<List<CarForBean>>() {
        }.getType());

    }
    /**
     * 获取订单状态
     *
     * @aram context
     * @return
     */
    public static List<CarForBean> getOrderTypeList(Context context) {
        String json = getFromAssets(context, "order_type.json");
        return new Gson().fromJson(json, new TypeToken<List<CarForBean>>() {
        }.getType());

    }
    /**
     * 获取成交失败的选项
     *
     * @aram context
     * @return
     */
    public static List<CarForBean> getDefeat(Context context) {
        String json = getFromAssets(context, "defeat_cause.json");
        return new Gson().fromJson(json, new TypeToken<List<CarForBean>>() {
        }.getType());

    }
}
